﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace PcCtrlUI
{
	/// <summary>
	/// Interaction logic for FanChannelCtrl.xaml
	/// </summary>
    /// 


	public partial class FanChannelCtrl : UserControl
	{
        private int fanch;
        /// <summary>
        /// does ist best
        /// </summary>




		public FanChannelCtrl()
		{
			this.InitializeComponent();
		}
		
		public void setNames(string name0, string name1, string name2, string name3)
		{
			this.fan0.setName(name0);
			this.fan1.setName(name1);
			this.fan2.setName(name2);
			this.fan3.setName(name3);
		}

        public void setMax(double max0, double max1, double max2, double max3)
        {
            this.fan0.setMax(max0);
            this.fan1.setMax(max1);
            this.fan2.setMax(max2);
            this.fan3.setMax(max3);

        }

        public void setValues(double value0, double value1, double value2, double value3)
        {
            this.fan0.setValue(value0);
            this.fan1.setValue(value1);
            this.fan2.setValue(value2);
            this.fan3.setValue(value3);
        }

        public void setFanChan(int fanch)
        {
            this.fanch = fanch;
        }

        private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            App app = (App)App.Current;
            int v = (int)Math.Round(e.NewValue * 10.0);
            app.getMcCOMChannel().setFanPWM(fanch, v);
        }

  

	}
}